/*-
 *  Copyright (C) 2009 Peter Baldwin   
 *  
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.peterbaldwin.client.android.sms2email;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class DeliveryReportReceiver extends BroadcastReceiver {
	@Override
	public void onReceive(Context context, Intent intent) {
		int resultCode = getResultCode();
		int resId;
		int duration;
		switch (resultCode) {
		case Activity.RESULT_OK:
			resId = R.string.notify_sent;
			duration = Toast.LENGTH_SHORT;
			break;
		case SmsManager.RESULT_ERROR_RADIO_OFF:
			resId = R.string.notify_failed_radio_off;
			duration = Toast.LENGTH_LONG;
			break;
		case SmsManager.RESULT_ERROR_NO_SERVICE:
			resId = R.string.notify_failed_no_service;
			duration = Toast.LENGTH_LONG;
			break;
		default:
			resId = R.string.notify_failed_generic;
			duration = Toast.LENGTH_LONG;
		}
		Toast toast = Toast.makeText(context, resId, duration);
		toast.show();
	}
}
